package service.impl;

import dao.ArticleMapper;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import pojo.Article;
import service.ArticleService;
import java.util.List;
@Transactional
@Service("articleService")
public class ArticleServiceImpl implements ArticleService {
        @Autowired
        private ArticleMapper articleMapper;

    public ArticleMapper getArticleMapper() {
        return articleMapper;
    }

    public void setArticleMapper(ArticleMapper articleMapper) {
        this.articleMapper = articleMapper;
    }
  
    @Override
    public List<Article> getALlArticle(Article article) {
        return  articleMapper.getALlArticle(article);
    }
    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public int addArticle(Article article) {
        return articleMapper.addArticle(article);
    }
    @Transactional(propagation = Propagation.REQUIRED)
    @Override
    public int deleteArticle(int id) {
        return articleMapper.deleteArticle(id);
    }

    @Override
    public int updateArticle(Article article) {
        return articleMapper.updateArticle(article);
    }

    @Override
    public List<Article> getALlArticleAndArticleofUser() {
        return articleMapper.getALlArticleAndArticleofUser();
    }

    @Override
    public List<Article> selectUserofArticle(int userid) {
        return articleMapper.selectUserofArticle(userid);
    }


}
